home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2002 #11 / Amiga Plus CD - 2002 - No. 11.iso / Tools / Development / PowerD / powerd / source / lib / powerd_lib.lha / PowerD / WriteF.ass < prev    next >
Text File  |  2001-12-29  |  830b  |  48 lines

  1. ; WriteF(a0:fmt:PTR TO CHAR,a1:lst:PTR TO LONG)
  2.  
  3.     xdef    _WriteF
  4.  
  5. _WriteF:    movem.l    d2-d3/a2-a3,-(a7)
  6.     tst.l    _stdout
  7.     beq.s    .nostd
  8. .havestd    lea    (.copychar,pc),a2
  9.     movea.l    4.w,a6
  10.     lea    (-512,a7),a7
  11.     movea.l    a7,a3
  12.     move.l    a3,d2
  13.     jsr    -522(a6)            ; RawDoFmt()
  14.     move.l    _stdout,d1
  15.     move.l    d2,a0
  16. .loop    tst.b    (a0)+
  17.     bne.s    .loop
  18.     sub.l    d2,a0
  19.     move.l    a0,d3
  20.     subq.l    #1,d3
  21.     move.l    _DOSBase,a6
  22.     jsr    (-48,a6)            ; Write()
  23.     move.l    d3,d0
  24.     lea    (512,a7),a7
  25.     movem.l    (a7)+,d2-d3/a2-a3
  26.     rts
  27. .copychar    move.b    d0,(a3)+
  28.     rts
  29. .nostd    lea    (.con,pc),a0
  30.     move.l    a0,d1
  31.     move.l    #1006,d2
  32.     move.l    _DOSBase,a6
  33.     jsr    -30(a6)            ; Open()
  34.     move.l    d0,_stdin
  35.     move.l    d0,_stdout
  36.     tst.l    d0
  37.     bne.s    .havestd
  38.     moveq    #20,d1
  39.     jsr    (-144,a6)            ; Exit()
  40.     movem.l    (a7)+,d2-d3/a2-a3
  41.     rts
  42. .con    dc.b    "con:0/11/640/80/output/close",0,0,0,0,0
  43.     even
  44.  
  45.     xref    _DOSBase
  46.     xref    _stdin
  47.     xref    _stdout
  48.